package cn.xumaoyang.org.controller;

import cn.xumaoyang.basic.exception.BusinessException;
import cn.xumaoyang.basic.util.AjaxResult;
import cn.xumaoyang.org.domain.Shop;
import cn.xumaoyang.org.service.IShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/shop")
public class ShopController {

    @Autowired
    private IShopService shopService;

    //点击入驻保存数据到数据库。
    @RequestMapping("/settlement")
    public AjaxResult settledIn(@RequestBody Shop shop){
        try {
            shopService.settledIn(shop);
            return new AjaxResult();
        }catch (BusinessException e) {
            e.printStackTrace();
            return new AjaxResult(false,e.getMessage());
        } catch (Exception g) {
            g.printStackTrace();
            return new AjaxResult(false,"系统繁忙请稍后再试");
        }
    }



}
